var baseURL = ctx + "/activiti/task";
$(function() {
	load3();
});

function load3() {
	$("#todoTaskTable3").jqGrid({
		url: baseURL + '/gotoList',
		datatype: "json",
		colModel: [
			{ label: '流程KEY1', name: 'key', width: 75,search: false },
			{ label: '流程名称', name: 'name', width: 75 },
			{ label: '版本号', name: 'version', width: 45,search: false},
			{ label: '流程图', name: 'id', width: 100, search: false,formatter:function (value,options, row) {
				var e = '<a   href="'+ ctx +"/activiti/process/resource/read/image/"+value+'"  title="图片" target="_blank">图片</a> ';
				return e;
			}},
			{ label: '操作', name: 'id', index: "create_time", width: 85,search: false, formatter : function(value, options, row) {
				var f = '<a class="btn btn-success btn-sm" href="#" title="发起任务"  mce_href="#" onclick="form3(\''
					+ value
					+ '\')"><i class="fa  fa-paper-plane"></i></a> ';
				return f;
			}}
		],
		viewrecords: true,
		height: 'auto',
		rowNum: 10,
		rowList : [10,30,50],
		rownumbers: true,
		rownumWidth: 25,
		width: document.body.clientWidth,
		multiselect: true,
		pager: "#todoTaskPager3",
		jsonReader : {
			root: "page.list",
			page: "page.currPage",
			total: "page.totalPage",
			records: "page.totalCount"
		},
		prmNames : {
			page:"page",
			rows:"limit",
			order: "order"
		},
		gridComplete:function(){
			//隐藏grid底部滚动条
			$("#todoTaskTable3").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
		}
	});
	$("#todoTaskTable3").filterToolbar({}).jqGrid('navGrid',"#todoTaskPager3",{//刷新按钮
		refresh: true,
		edit:false,del: false,search:false,add:false
	});
}
function reLoad3() {
	var page = $("#todoTaskTable3").jqGrid('getGridParam','page');
	$("#todoTaskTable3").jqGrid('setGridParam',{
		postData:{},
		page:page
	}).trigger("reloadGrid");
	$("#todoTaskTable3").setGridWidth(document.body.clientWidth);
}
function form3(id) {
    layer.open({
        type : 2,
        title : '发起流程',
        maxmin : true,
        shadeClose : false,
        area : [ '100%', '100%' ],
        content : baseURL +'/form/'+id
    })
}

